<!--
 * @Description: 
 * @version: 
 * @Author: liurui
 * @Date: 2024-02-18 16:49:20
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2024-02-19 09:24:44
-->
<template>
    <div>

    </div>
</template>

<script setup lang="ts">
// 移除索引签名
type Foo = {
  [key: string]: any;
  foo(): void;
}

type A = RemoveIndexSignature<Foo>  // expected { foo(): void }

// string extends T ， 表示 string 继承 T 类型， 是 T 的子类型，具有 T 的所有属性
type isStringNumberSymbol<T> = string extends T
  ? never
  : number extends T
  ? never
  : symbol extends T
  ? never
  : T;

type RemoveIndexSignature<T> = {
  [P in keyof T as isStringNumberSymbol<P>]: T[P];
};
</script>

<style scoped>

</style>